import {
  IsOptional,
  IsArray,
  IsNotEmpty,
  MaxLength,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import PlanMotionDto from './plan.motion.dto'

export default class CreatePlanDto {
  @IsNotEmpty({ message: '计划名称不能为空' })
  @MaxLength(20, { message: '计划名称最长20个字符' })
  name: string;

  @IsOptional()
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => PlanMotionDto)
  motions?: PlanMotionDto[] = [];
}
